home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / internet / tcp / amitcp / amitcp-src-22.lha / AmiTCP-2.2 / src / appl / napsaterm / nifty.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-07  |  3.0 KB  |  80 lines

  1. /* nifty.h -- useful macros, etc.
  2.  *
  3.  * Copyright 1988, Chris Newman
  4.  * All Rights Reserved
  5.  * Permission is granted ot copy, modify, and use this as long
  6.  * as this notice remains intact.  This is a nifty program.
  7.  *
  8.  * Some of these #defines were swiped from various places
  9.  *
  10.  * DISCLAIMER: the author (and maintainer) of this program is not responsible
  11.  * for any damage or other problems caused by it.
  12.  *
  13.  * $Author: ppessi $ $Revision: 1.7 $ $Date: 1993/10/07 23:59:39 $
  14.  */
  15.  
  16. #ifndef _NIFTY_
  17. #define _NIFTY_
  18.  
  19. #define PROGNAME "Napsaterm"
  20. #define DEFAULTFONT "napsa/11"
  21. #define RESOURCELIST "amitcp:db/napsaprefs\0" "s:napsaprefs\0" "s:niftyprefs\0"
  22.  
  23. /* types */
  24. #define    Boolean int
  25. typedef    char    BOOLEAN;
  26. typedef    unsigned short ushort;
  27. typedef    unsigned char  uchar;
  28.  
  29. enum iotype { serial, stdio, dnet, rlogin };
  30.  
  31. /* constants */
  32. #undef CTRL
  33. #define CTRL(a) ((a) & 0x1f)
  34. #define    ESC    '\033'
  35. #define    DEL    '\177'
  36.  
  37. /* bound and limit macros */
  38. #define    SLIMIT(a, b)        ((a) >= (b) ? ((a) = (b) - 1) : (a))
  39. #define    SLIMITCK(a, b)        if ((a) >= (b)) (a) = (b) - 1
  40. #define    MAXBOUND(a, b)        ((a) > (b) ? (a) = (b): (a))
  41. #define    MAXBOUNDCK(a, b)    if ((a) > (b)) (a) = (b)
  42. #define    MINBOUND(a, b)        ((a) < (b) ? (a) = (b): (a))
  43. #define    MINBOUNDCK(a, b)    if ((a) < (b)) (a) = (b)
  44. #define    BOUNDS(a, l, h)        ((a) < (l) ? (a) = (l) : ((a) > (h) ? (a) = (h) : (a)))
  45. #define    BOUNDSCK(a, l, h)   if ((a) < (l)) (a) = (l); else if ((a) > (h)) (a) = (h)
  46.  
  47. /* useful macros */
  48. #undef ABS
  49. #undef MIN
  50. #undef MAX
  51. #define    ABS(a)        ((a) < 0 ? -(a) : (a))
  52. #define    MAX(a, b)   ((a) > (b) ? (a) : (b))
  53. #define    MIN(a, b)   ((a) < (b) ? (a) : (b))
  54. #define    XSWAP(a, b) ((a) ^= (b), (b) ^= (a), (a) ^= (b))
  55. #define SWAP(a, b)  {register int xxx = a; a = b; b = xxx;}
  56. #define    XOR(a, b)   ( ((a) ? 1 : 0) ^ ((b) ? 1 : 0) )
  57.  
  58. /* case macros */
  59. #define    ISDIGIT         '0': case '1': case '2': case '3': case '4': case '5': \
  60.       case '6': case '7': case '8': case '9'
  61. #define    ISUPPER         'A': case 'B': case 'C': case 'D': case 'E': case 'F': \
  62.       case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': \
  63.       case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': \
  64.       case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z'
  65. #define    ISLOWER         'a': case 'b': case 'c': case 'd': case 'e': case 'f': \
  66.       case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': \
  67.       case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': \
  68.       case 'u': case 'v': case 'w': case 'x': case 'y': case 'z'
  69. #define    ISALPHA        ISUPPER: case ISLOWER
  70. #define    PRINTABLE    ' ': case '!': case '"': case '#': case '$': case '%': \
  71.       case '&': case'\'': case '(': case ')': case '*': case '+': case ',': \
  72.       case '-': case '.': case '/': case ':': case ';': case ISDIGIT: \
  73.       case '<': case '=': case '>': case '?': case '@': case ISUPPER: \
  74.       case '[': case'\\': case ']': case '^': case '_': case '`': \
  75.       case ISLOWER: case '{': case '|': case '}': case '~'
  76.  
  77. #include "all_protos.h"
  78. #endif 
  79.  
  80.